<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@ page language="java" import='java.util.ArrayList'%>
<%@ page language="java" import='to.*'%>
<%@ page language="java" import='java.text.DecimalFormat'%>

<%
response.setHeader("Content-type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=Reporte_Pedidos.xls");
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Reporte de Pedidos</title>
    </head>
    <body>
        <table border="1" align="center" style="border:'1px solid #BFCDD4'; margin: '0 auto'; padding: '15px 0pt 15px';" width="100%">
        <tr>
           <td colspan="7" align="center"><b>REPORTE DE ORDENES DE PEDIDO</b></td>
        </tr>
        <tr>
           <td align="center" bgcolor="#EEF3F6"><b>Número Pedido</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Cliente</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Fecha Pedido</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Moneda</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Total</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Usuario</b></td>
           <td align="center" bgcolor="#EEF3F6"><b>Estado Pedido</b></td>
        </tr>
       <%
            ArrayList listord = (ArrayList) request.getSession().getAttribute("listadoOrdenes");
            for (int i = 0; i < listord.size(); i++) {
                OrdenPedidoTO orden = (OrdenPedidoTO) listord.get(i);
                String[] colors = {"#EAEAEA","#FAFAFA"};
       %>
        <tr>   
           <td align="center" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8">Nro.&nbsp;<%=orden.getNOrdenPedido()%></font></td>
           <td align="left" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8"><%=orden.getDCliente()%></font></td>
           <td align="center" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8">Fec.&nbsp;<%=orden.getFOrdenPedido()%></font></td>
           <td align="center" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8"><%=orden.getCMoneda()%></font></td>
           <td align="right" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8"><%=new DecimalFormat("### ###.00").format(orden.getITotal())%></font></td>
           <td align="center" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8"><%=orden.getCUsuarioCreo()%></font></td>
           <td align="center" bgcolor="<%=(colors[i%2])%>"><font color="#6190B8"><%=orden.getDEstado()%></font></td>
        </tr> 
       <%
            }
       %>
        </table>
    </body>
</html>
